Expand description
The Solana host and client SDK.
This is the base library for all off-chain programs that interact with
Solana or otherwise operate on Solana data structures. On-chain programs
instead use the solana-program
crate, the modules of which are
re-exported by this crate, like the relationship between the Rust
core
and std
crates. As much of the functionality of this crate is
provided by solana-program
, see that crate’s documentation for an
overview.
Many of the modules in this crate are primarily of use to the Solana runtime
itself. Additional crates provide capabilities built on solana-sdk
, and
many programs will need to link to those crates as well, particularly for
clients communicating with Solana nodes over RPC.
Such crates include:
solana-client
- For interacting with a Solana node via the JSON-RPC API.solana-cli-config
- Loading and saving the Solana CLI configuration file.solana-clap-utils
- Routines for setting up the CLI usingclap
, as used by the Solana CLI. Includes functions for loading all types of signers supported by the CLI.
Re-exports§
pub extern crate bs58;
pub use signer::signers;
pub use solana_program::account_info;
pub use solana_program::clock;
pub use solana_program::fee_calculator;
pub use solana_program::native_token;
pub use solana_program::program_option;
pub use solana_program::program_pack;
pub use solana_program::rent;
pub use solana_program::serialize_utils;
pub use solana_program::stable_layout;
pub use solana_account as account;
pub use solana_bn254 as alt_bn128;
pub use solana_decode_error as decode_error;
pub use solana_derivation_path as derivation_path;
pub use solana_feature_set as feature_set;
pub use solana_inflation as inflation;
pub use solana_packet as packet;
pub use solana_program_memory as program_memory;
pub use solana_sanitize as sanitize;
pub use solana_secp256k1_recover as secp256k1_recover;
pub use solana_serde_varint as serde_varint;
pub use solana_short_vec as short_vec;
Modules§
- Useful extras for
Account
state. - Hashing with the blake3 hash function.
- Utilities for the borsh serialization format.
- Utilities for the borsh serialization format, version 0.10.
- Utilities for the borsh serialization format, version 1.
- The latest BPF loader native program.
- The original and now deprecated Solana BPF loader.
- An upgradeable BPF loader native program.
- Defines traits for blocking (synchronous) and non-blocking (asynchronous) communication with a Solana server as well a a trait that encompasses both.
- Definitions of commitment levels.
- The compute budget native program.
- Debug-formatting of account data.
- Serde helpers.
- Instructions for the ed25519 native program.
- The Rust-based BPF program entrypoint supported by the latest BPF loader.
- The Rust-based BPF program entrypoint supported by the original BPF loader.
- Information about the current epoch.
- A type to hold data for the
EpochRewards
sysvar. - Used by validators to run events on exit.
- Methods for working with
Feature
accounts. - Fee structures.
- The chain’s genesis config.
- The list of slot boundaries at which a hard fork should occur.
- A designated address for burning lamports.
- Hashing with the keccak (SHA-3) hash function.
- Re-exports the
LamportsError
type for backwards compatibility. - Instructions for the non-upgradable BPF loader.
- Instructions for the upgradable BPF loader.
- The v4 built-in loader program.
- Instructions for the v4 built-in loader program.
- Sequences of
Instruction
s executed within a single transaction. - The native loader native program.
- Durable transaction nonces.
- Functions related to nonce accounts.
- Off-chain message container for storing non-transaction messages.
- Definitions of Solana’s proof of history.
- Solana precompiled programs.
- Wrappers around
solana-cpi
with support for overwriting syscall stubs - Implementations of syscalls used when
solana-program
is built for non-SBF targets. - Contains a single utility function for deserializing from bincode.
- Definitions related to Solana over QUIC.
- calculate and collect rent from Accounts
- Collection of reserved account keys that cannot be write-locked by transactions. New reserved account keys may be added as long as they specify a feature gate that transitions the key into read-only at an epoch boundary.
- Enumeration of reward types.
- RPC default port numbers.
- sdk_ids
Deprecated A vector of Solana SDK IDs. - Instructions for the secp256k1 native program.
- Calculation of shred versions.
- Functionality for public and private keys.
- Abstractions and implementations for transaction signers.
- The stake native program.
- A type to hold data for the
StakeHistory
sysvar. - Declarations of Solana program syscalls.
- Instructions and constructors for the system program.
- The
system_transaction
module provides functionality for creating system transactions. - Access to special accounts with dynamically-updated data.
- The
timing
module provides std::time utility functions. - Atomically-committed sequences of instructions.
- Data shared between program runtime and built-in programs as well as SBF programs.
- Defines the
TransportError
type. - The vote native program.
Macros§
- Define the default global allocator.
- Define the default global panic handler.
- Same as
declare_id
except report that this id has been deprecated. - Same as
declare_sysvar_id
except that it reports that this ID has been deprecated. - Convenience macro to declare a static public key and functions to interact with it.
- Declares an ID that implements
SysvarId
. - Implements the
Sysvar::get
method for both SBF and host targets. - Print a message to the log.
- Convenience macro to define a static public key.
- Convenience macro to define multiple static public keys.
- Convenience macro for
AddAssign
with saturating arithmetic. Replace bystd::num::Saturating
once stable - Convenience macro for doing integer division where the operation’s safety can be checked at compile-time.